package com.skcc.cop.mrtaxi.biz.faq;

import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.skcc.cop.mrtaxi.BaseActivity;
import com.skcc.cop.mrtaxi.R;
import com.skcc.cop.mrtaxi.util.LogControl;
import com.skcc.cop.mrtaxi.view.TitleBar;
import com.skcc.cop.mrtaxi.view.TitleBar.OnTitleBarEventListener;

public class FaqActivity extends BaseActivity implements OnTitleBarEventListener {

	// ===========================================================
	// Constants
	// ===========================================================
	private static final String TAG = FaqActivity.class.getSimpleName();

	private TitleBar mTitleBarView;

	private WebView mWebview;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_faq);

		mTitleBarView = (TitleBar) this.findViewById(R.id.titlebar_view);
		mTitleBarView.setEventListener(this);
		mTitleBarView.showBack();
		mTitleBarView.setTitle(R.string.title);

		mWebview = (WebView) findViewById(R.id.faq_webview);

		mWebview.getSettings().setJavaScriptEnabled(true);
		mWebview.getSettings().setDefaultTextEncodingName("UTF-8");
		mWebview.setWebViewClient(new WebViewClientClass());

	}
	
	@Override
    protected void onResume() {
        super.onResume();
        
        LogControl.d(TAG, " in onResume >>>>>");
        
        mWebview.loadUrl("file:///android_asset/faq_content.html");
    }
    
    @Override
    protected void onPause() {
        super.onPause();
        
        LogControl.d(TAG, " in onPause >>>>>");
    }

	@Override
	public void onBackClicked() {
		LogControl.d(TAG, " in onBackClicked >>>>>");
		finish();

	}

	@Override
	public void onAddClicked() {
		// TODO Auto-generated method stub

	}

	private class WebViewClientClass extends WebViewClient {
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			view.loadUrl(url);
			return true;
		}
	}

}
